<?php @session_start();?>
<?php
require_once('./safe.php');
require_once('../admin/config.php');
$conn = mysql_connect($cfg_dbhost,$cfg_dbuser,$cfg_dbpwd);
mysql_select_db($cfg_dbname,$conn);

$app_id=$_REQUEST["app_id"];
$keyword=$_REQUEST["keyword"];

 header("Content-type:application/json");
$sqla="select * from ph_keywords where userid='".$_SESSION["userid"]."' and app_name='".$app_id."' and keywords='".$keyword."'";
$resulta=mysql_query($sqla);
if(mysql_num_rows($resulta)<1){
$sql = "INSERT INTO ph_keywords(userid,app_name,keywords)VALUES('".$_SESSION["userid"]."','".$app_id."','".$keyword."')";
mysql_query($sql,$conn);
}

 echo '{"status":true,"errors":[]}';
?>